<?php

$username = $_POST['username'];
$password = $_POST['password'];

if (isset($username)) {
    $username = trim($username);
}

if (isset($password)) {
    $password = trim($password);
}

$sql = "SELECT * FROM t_admin WHERE username = '" . $username . "' AND password = '" . $password . "'";
$db = new DBC();
$data = $db->fetchData($sql);
if (count($data) > 0) {
    $_SESSION['username'] = $username;
    header("packList.php");
    //确保重定向后，后续代码不会被执行
    exit;
}
?>
